<link rel="stylesheet" href="/static/admin/hui/static/h-ui/css/H-ui.css">
<style>
	.mt{margin-top: 15px;}
</style>
<section id="add" style="padding: 15px;">

	<div>
		<label class="label label-default radius">板块名称</label>
		<input type="text" v-model="name" class="input-text" placeholder="请输入更改后的板块名称">
	</div>

</section>
<script src="/static/admin/js/jquery.min.js"></script>
<script src="/static/admin/layer/layer.js"></script>
<script src="/static/admin/js/h.js"></script>
<script src="/static/admin/eleme/vue.js"></script>

<script>
var vm = new Vue({
	el: '#add',
	data: {
		name: '',
		pid: 0,
		id: 0,
	},
	mounted: function(){
		this.pid = {{pid}};
		if ({{bk|safe}} !== 1) {
			this.name = {{bk|safe}}.name;
			this.id = {{bk|safe}}.id;
		}
	}
})

function call_submit(index){
	if (/^\s*$/.test(vm.name)) {
		layer.msg('请正确输入板块名称', {icon:2,time:2000});
		return false;
	}
	let data = {
		id: vm.id,
		name: vm.name,
		pid: vm.pid,
		category: {{ ct }},
	}
	H.ajax('/admin/quanxian/add',data,'post',function(res){
		parent.layer.msg(res.data, {icon:1, time:2000});
		setTimeout(function(){
			parent.refresh()
			parent.layer.close(index);
		}, 2000)
		
	})
}
</script>